package com.digdes.calendar.model.impl;

import java.util.HashSet;
import java.util.Set;

import com.digdes.calendar.gwt.client.dto.UserDTOImpl;
import com.digdes.calendar.model.Event;
import com.digdes.calendar.model.Group;
import com.digdes.calendar.model.User;

public class UserImpl implements User {

    private Long id;
    private String surname;
    private String name;
    private String patronymic;
    private String email;
    private String post;




    //one-to-many
    private Set<Event> authorsEvents = new HashSet<Event>();
    //many-to-one
    private Set<Event> events = new HashSet<Event>();

    private Set<Group> groups = new HashSet<Group>();

    public UserImpl() {
    }

    public UserImpl(UserDTOImpl userDTO){
        this.id = userDTO.getId();
        this.surname = userDTO.getSurname();
        this.name = userDTO.getName();
        this.patronymic = userDTO.getPatronymic();
        this.email = userDTO.getEmail();
        this.post = userDTO.getPost();
        //
    }
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPatronymic() {
        return patronymic;
    }

    public void setPatronymic(String patronymic) {
        this.patronymic = patronymic;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public Set<Event> getEvents() {
        return events;
    }

    public void setEvents(Set<Event> events) {
        this.events = events;
    }

    public Set<Event> getAuthorsEvents() {
        return authorsEvents;
    }

    public void setAuthorsEvents(Set<Event> authorsEvents) {
        this.authorsEvents = authorsEvents;
    }

    public Set<Group> getGroups() {
        return groups;
    }

    public void setGroups(Set<Group> groups) {
        this.groups = groups;
    }



    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("UserImpl");
        sb.append("{id=").append(id);
        sb.append(", surname='").append(surname).append('\'');
        sb.append(", name='").append(name).append('\'');
        sb.append(", patronymic='").append(patronymic).append('\'');
        sb.append(", email='").append(email).append('\'');
        sb.append(", post='").append(post).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
